package com.lyj.mall.controller;

import com.lyj.mall.consts.MethodConst;
import com.lyj.mall.service.CategoryService;
import com.lyj.mall.vo.CategoryVo;
import com.lyj.mall.vo.ResponseVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author lyj
 * @date 2020/1/2 23:46
 */
@RestController
@RequestMapping(value = "/category")
@Api(tags = "类目模块Controller")
public class CategoryController extends BaseController {

    @Autowired
    private CategoryService categoryService;

    @GetMapping
    @ApiOperation(value = "获取所有商品")
    public ResponseVo getAll() {
        insertLog("获取所有商品", MethodConst.QUERY, "");
        ResponseVo<List<CategoryVo>> categoryVoList = categoryService.selectAll();
        return ResponseVo.success(categoryVoList);
    }
}
